#include "AudioProcessor.h"
#include "core/gamestream/XComponentBackend.h"
#include "core/utils/AudioStreamUtils.h"
#include <opus_multistream.h>

#undef LOG_DOMAIN
#undef LOG_TAG
#define LOG_DOMAIN  0x0
#define LOG_TAG     "AudioProcessor"
#include <hilog/log.h>


AudioProcessor::AudioProcessor(XComponentBackend *xcomp) :
        xcomp(*xcomp),
        decoder(nullptr), renderer(nullptr) {
}

AudioProcessor::~AudioProcessor() {
    renderReadyCond.notify_all();
    if (decoder) {
        opus_multistream_decoder_destroy(decoder);
    }
    if (renderer) {
        AS_CALL_OR_ELSE(OH_AudioRenderer_Release(renderer),);
    }
}
